<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h2><%=book._id?'更新':'添加'%>图书</h2>
  <form action="/book/<%=book._id?'update':'add'%>" method="post">
    <!-- 只有更新才产生隐含表单项 -->
    <%
      if (book._id) {
    %>
      <input type="hidden" name="_id" value="<%=book._id%>">
    <%
      }
    %>

    书名: <input type="text" name="name" value="<%=book.name%>"><br/>
    作者: <input type="text" name="author" value="<%=book.author%>"><br/>
    价格: <input type="number" name="price" value="<%=book.price%>"><br/>
    <input type="submit" value="提交">
  </form>
</body>
</html>